import request from '@/utils/request'

// 查询用户考核列表
export function listAssessUser(query) {
  return request({
    url: '/system/assessUser/list',
    method: 'get',
    params: query
  })
}

// 查询用户考核详细
export function getAssessUser(id) {
  return request({
    url: '/system/assessUser/' + id,
    method: 'get'
  })
}

// 新增用户考核
export function addAssessUser(data) {
  return request({
    url: '/system/assessUser',
    method: 'post',
    data: data
  })
}

// 修改用户考核
export function updateAssessUser(data) {
  return request({
    url: '/system/assessUser',
    method: 'put',
    data: data
  })
}

// 删除用户考核
export function delAssessUser(id) {
  return request({
    url: '/system/assessUser/' + id,
    method: 'delete'
  })
}

// 批量分配考核任务
export function assignAssessTasks(data) {
  return request({
    url: '/system/assessUser/assign',
    method: 'post',
    data: data
  })
}

// 根据日期查询当前用户考核数据
export function getAssessByDate(query) {
  return request({
    url: '/system/assessUser/getAssessByDate',
    method: 'get',
    params: query
  })
}

// 获取当前用户可以审核的人员
export function getAssessUserByUser(query) {
  return request({
    url: '/system/assessUser/getAssessUserByUser',
    method: 'get',
    params: query
  })
}

// 获取可管理的角色及其员工
export function getAssessRolesWithUsers(query) {
  return request({
    url: '/system/assessUser/getAssessRolesWithUsers',
    method: 'get',
    params: query,
    headers: {
      'Cache-Control': 'no-cache',
      'Pragma': 'no-cache'
    }
  })
}

// 根据时间段获取已存在的考核数据
export function getExistingByDateRange(query) {
  return request({
    url: '/system/assess/getExistingByDateRange',
    method: 'get',
    params: query
  })
}
